package cn.study;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class Animal {
    private String name;


    public Animal() {

    }

    public Animal(String name) {
        this.name = name;
    }

    public void display(){
        System.out.print("我是："+this.getName()+"\n我吃");

    }

    public void  eat(String name){
        if ("rabbit".equals(name)){
            System.out.print("草");
        }
        else{
            System.out.print("肉");
        }
    }

    public void sleep(){
        System.out.println("我睡觉去了");
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
